package com.cgc.venus.server.ci.model.dao;
import com.cgc.venus.server.ci.model.entity.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;

/**
 * Created by 业哥 on 2018/11/12
 */
@Mapper
public interface PipelineDao {
    public List<CiPipeline> findPipelineByKey(@Param("key") String key,@Param("namespace") String namespace);
    public CiPipeline findPipelineById(@Param("id") String id);
    public List<PipelinePara> findPipelineParaByPipelineId(@Param("pipelineId") String pipelineId);
    public List<PipelineStage> findPipelineStageByPipelineId(@Param("pipelineId") String pipelineId);
    public List<PipelineJob> findPipelineJobByPipelineIdAndStageId(@Param("pipelineId") String pipelineId,@Param("stageId") String stageId);
    public String findHarborProjectNameByNamespaceId(@Param("id") String id);

    public int insertCiPipeline(@Param("cp") CiPipeline cp);
    public int batchInsertCiPipelinePara(List<PipelinePara> pps);
    public int batchInsertCiPipelineStage(List<PipelineStage> pss);
    public int batchInsertCiPipelineJob(List<PipelineJob> pjs);

    public int deleteCiPipelineById(@Param("id") String id);
    public int deletePipelineParaByPipelineId(@Param("pipelineId") String pipelineId);
    public int deletePipelineStageByPipelineId(@Param("pipelineId") String pipelineId);
    public int deletePipelineJobByPipelineId(@Param("pipelineId") String pipelineId);

    public int updateCiPipeline(@Param("cp") CiPipeline cp);
}